package com.hqyj.javaSpringBoot.modules.common.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description：ImageType
 * @Author ：Cwd
 * @Date ：2021/8/24 9:09
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)    //JSON格式化
public enum ImageType {
    PROFILE_BIG("profile-big",100,220,220),
    PROFILE_SMALL("profile-small",20,50,50);

    public String name;
    public int size;
    public int length;
    public int height;

    ImageType(String name, int size, int length, int height) {
        this.name = name;
        this.size = size;
        this.length = length;
        this.height = height;
    }

    public static ImageType getImageTypeByName(String name){
        for (ImageType imageType : ImageType.values()){
            if (imageType.name.equals(name)){
                return imageType;
            }
        }
        return null;
    }

    /*public static void main(String[] args) {
        System.out.println(ImageType.values());
        System.out.println(ImageType.valueOf("PROFILE_BIG").size);
        System.out.println(ImageType.getImageTypeByName("profile_small").size);
    }*/
}
